<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <button id="one">按钮</button>
    <script src="https://cdn.bootcdn.net/ajax/libs/lodash.js/4.17.21/lodash.min.js"></script>
    <script>
      function throttle(fn, wait) {
        let lastTime = 0;
        return function (...args) {
          const now = Date.now();
          if (now - lastTime >= wait) {
            lastTime = now;
            fn();
          }
        };
      }

      function getClick() {
        console.log("点击事件处理函数");
      }

      // 使用节流函数
      const throttledScroll = throttle(getClick, 1000);

      var btn = document.querySelector("#one");
      btn.addEventListener("click", throttledScroll);
    </script>
  </body>
</html>
